<template>
  <div class="backView">
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item, index) in imgs" :key="index">
        <div class="imgBackView">
          <img @click='click(index)' class="img" :src="item.imageUrl"/>
        </div>

      </van-swipe-item>
    </van-swipe>
  </div>

</template>

<script>
  import {Swipe, SwipeItem} from 'vant'

  Vue.use(Swipe);
  Vue.use(SwipeItem);

  export default {
    props: ['imgs'],
    methods: {
      click(index) {
        let item = this.imgs[index]

        if (item.targetValue == '') {
          return;
        }

        if (item.type == 3) {
          this.$_router.push(`/course/courseDetail/${item.targetValue}`)
        } else if (item.type == 5) {
          //统筹考试
          this.$_router.push(`/exam/normal/${item.targetValue}/0/1`)
        } else if (item.type == 1) {
          window.location.href = item.targetValue
        } else if (item.type == 4) {
          this.$_router.push(`/plan/${item.targetValue}`)
        }
      }
    }
  }
</script>

<style scoped>
  .backView {

  }

  .my-swipe {
    width: 100%;

  }

  .imgBackView {
    width: 100%;
    /*height: 0;*/
    /*padding-bottom: 50%;*/
    overflow: hidden;
  }

  .img {
    /*object-fit: fill;*/
    width: 100%;
  }
</style>
